<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    	<center>
    		<h1>用户列表</h1>
    		<form action="list" method="post">
    			用户账号<input type="text" name="userAccount" value="${userAccount }"/>
    			部门 
    					<select name="deptId">
    						<option value="">请选择</option>
    						<c:forEach items="${allDepts}" var="allDepts">
    						<option <c:if test="${allDepts.deptId==deptId }">selected</c:if> value="${allDepts.deptId }">${allDepts.deptName }</option>
    						</c:forEach>
    					</select>
    				<input type="submit" value="查询"/>
    				<input type="reset" value="清空"/>
    		</form>
    		
    		
    			<table border="1px">
    				<tr>
    					<th>序号</th>
    					<th>用户账号</th>
    					<th>邮箱</th>
    					<th>所属部门</th>
    					<th>创建时间</th>
    					<th>操作</th>
    				</tr>
    				<c:forEach items="${page.list }" var="list" varStatus="s">
    					<tr>
    						<td>${s.index+1 }</td>
    						<td>${list.userAccount }</td>
    						<td>${list.email }</td>
    						<td>${list.deptName }</td>
    						<td>${list.createDate }</td>
    						<td>
    							<a href="del?userId=${list.userId }">删除</a>
    							<a href="toupdate?userId=${list.userId }">修改</a>
    						</td>
    					</tr>
    				</c:forEach>
    			</table>
    			共${page.pageCount}页
    			<a href="list?userAccount=${userAccount }&deptId=${deptId}&pageNo=1">首页</a>
    			<c:if test="${page.pageNo>1 }">
    				<a href="list?userAccount=${userAccount }&deptId=${deptId}&pageNo=${page.pageNo-1}">上一页</a>
    			</c:if>
    			<c:if test="${page.pageNo<page.pageCount }">
    				<a href="list?userAccount=${userAccount }&deptId=${deptId}&pageNo=${page.pageNo+1}">下一页</a>
    			</c:if>
    			<a href="list?userAccount=${userAccount }&deptId=${deptId}&pageNo=${page.pageCount}">末页</a>
    			第${pageNo}页
    			
    	</center>
  </body>
  
</html>
